﻿using STT.DataAccess;
using STT.Entities;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace STT.Business
{
    public class BTbTaiLieu
    {
        public static void Insert(ETbTaiLieu OTbTaiLieu)
        {
            SqlParameter[] pr = new SqlParameter[6];
            pr[0] = new SqlParameter(@"MaGV", OTbTaiLieu.MaGV);
            pr[1] = new SqlParameter(@"TieuDeGui", OTbTaiLieu.TieuDeGui);
            pr[2] = new SqlParameter(@"TenTL", OTbTaiLieu.TenTL);
            pr[3] = new SqlParameter(@"Link", OTbTaiLieu.Link);
            pr[4] = new SqlParameter(@"NgayGui", OTbTaiLieu.NgayGui);
            pr[5] = new SqlParameter(@"MaLop", OTbTaiLieu.MaLop);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "TbTaiLieu_Insert", pr);
        }
        public static DataTable SelectAllByMaGV(string MaGV) 
        {
            SqlParameter[] pr = new SqlParameter[1];
            pr[0] = new SqlParameter(@"MaGV", MaGV);
            DataTable all = SqlHelper.ExecuteData(CommandType.StoredProcedure, "TbTaiLieu_SelectByMaGV", pr);
            return all;
        }
    }
}